<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const obj = {
        name: "A",
        name5: {
          kkx: "455",
        },
        name6: ["236"],
        name1: undefined,
        name3: function () {},
        name4: Symbol("A"),
      };
      const obj2 = JSON.parse(JSON.stringify(obj));
      console.log(obj2); // {name: "A"}
      console.log(JSON.stringify(obj));//JSON.stringify方法转化对象为字符串时会忽略undefined和函数和Symbol三种类型
    </script>
  </body>
</html>
